home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
update1a
/
frmftp.frm
< prev
next >
Wrap
Text File
|
1999-07-26
|
18KB
|
586 lines
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
Begin VB.Form frmVBFTPJR
Caption = "FTP for WebNet Browser"
ClientHeight = 6816
ClientLeft = 60
ClientTop = 348
ClientWidth = 9228
LinkTopic = "Form1"
ScaleHeight = 6816
ScaleWidth = 9228
StartUpPosition = 2 'CenterScreen
Begin VB.OptionButton optAscii
Caption = "Ascii"
Height = 195
Left = 3480
TabIndex = 20
Top = 2640
Width = 732
End
Begin VB.OptionButton optBin
Caption = "Binary"
Height = 375
Left = 3480
TabIndex = 19
Top = 2280
Width = 732
End
Begin VB.CommandButton cmdPut
Caption = "Download"
Height = 300
Left = 3480
TabIndex = 18
Top = 3360
Width = 1092
End
Begin VB.CommandButton cmdGet
Caption = "Upload"
Height = 300
Left = 3480
TabIndex = 17
Top = 3000
Width = 1092
End
Begin ComctlLib.TreeView TreeView1
Height = 4452
Left = 120
TabIndex = 16
Top = 2280
Width = 3252
_ExtentX = 5736
_ExtentY = 7853
_Version = 327680
Style = 7
Appearance = 1
End
Begin VB.FileListBox File1
Height = 5256
Left = 6840
TabIndex = 15
Top = 1440
Width = 2052
End
Begin VB.DirListBox Dir1
Height = 5256
Left = 4680
TabIndex = 14
Top = 1440
Width = 2052
End
Begin VB.DriveListBox Drive1
Height = 288
Left = 4680
TabIndex = 13
Top = 1080
Width = 4212
End
Begin VB.CheckBox chkPassive
Caption = "Passive FTP syntax"
Height = 255
Left = 6600
TabIndex = 12
Top = 360
Width = 1692
End
Begin VB.CommandButton cmdDisconnect
Caption = "Disconnect"
Height = 250
Left = 2400
TabIndex = 11
Top = 480
Width = 1092
End
Begin VB.CommandButton cmdConnect
Caption = "Connect"
Height = 250
Left = 2400
TabIndex = 10
Top = 120
Width = 1092
End
Begin VB.TextBox txtPassword
Height = 288
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 9
ToolTipText = "Your Password"
Top = 1440
Width = 2892
End
Begin VB.TextBox txtUser
Height = 288
Left = 1680
TabIndex = 7
ToolTipText = "Your User Name"
Top = 1080
Width = 2892
End
Begin VB.TextBox txtServer
Height = 288
Left = 3600
TabIndex = 4
ToolTipText = "Server Name"
Top = 360
Width = 2772
End
Begin VB.CommandButton cmdClosehOpen
Caption = "Close Internet Session"
Height = 250
Left = 240
TabIndex = 3
Top = 480
Width = 1932
End
Begin VB.TextBox txtProxy
Height = 288
Left = 2640
TabIndex = 1
Top = 1800
Width = 1932
End
Begin VB.CommandButton cmdInternetOpen
Caption = "Start Internet Session"
Height = 250
Left = 240
TabIndex = 0
Top = 120
Width = 1935
End
Begin ComctlLib.ImageList ImageList1
Left = 2280
Top = 6240
_ExtentX = 995
_ExtentY = 995
BackColor = -2147483643
MaskColor = 12632256
_Version = 327680
End
Begin VB.Label label4
Caption = "Password:"
Height = 252
Left = 120
TabIndex = 8
Top = 1440
Width = 852
End
Begin VB.Label Label3
Caption = "User Name:"
Height = 252
Left = 120
TabIndex = 6
Top = 1080
Width = 972
End
Begin VB.Label Label2
Caption = "FTP Server Name:"
Height = 252
Left = 3600
TabIndex = 5
Top = 120
Width = 1452
End
Begin VB.Line Line1
X1 = 240
X2 = 9000
Y1 = 840
Y2 = 840
End
Begin VB.Label Label1
Caption = "(No CERN) TIS Compatible Proxy:"
Height = 252
Left = 120
TabIndex = 2
Top = 1800
Width = 2532
End
End
Attribute VB_Name = "frmVBFTPJR"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim bActiveSession As Boolean
Dim hOpen As Long, hConnection As Long
Dim dwType As Long
Dim EnumItemNameBag As New Collection
Dim EnumItemAttributeBag As New Collection
Private Sub Form_Load()
bActiveSession = False
hOpen = 0
hConnection = 0
chkPassive.Value = 1
optBin.Value = 1
dwType = FTP_TRANSFER_TYPE_BINARY
Dim imgI As ListImage
Set imgI = ImageList1.ListImages.Add(, "open", LoadPicture("open.bmp"))
Set imgI = ImageList1.ListImages.Add(, "closed", LoadPicture("closed.bmp"))
Set imgI = ImageList1.ListImages.Add(, "leaf", LoadPicture("leaf.bmp"))
Set imgI = ImageList1.ListImages.Add(, "root", LoadPicture("root.bmp"))
TreeView1.ImageList = ImageList1
TreeView1.Style = tvwTreelinesPictureText
EnableUI (False)
End Sub
Private Sub Form_Unload(Cancel As Integer)
cmdClosehOpen_Click
End Sub
Private Sub cmdInternetOpen_Click()
If Len(txtProxy.Text) <> 0 Then
hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_PROXY, txtProxy.Text, vbNullString, 0)
Else
hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)
End If
If hOpen = 0 Then ErrorOut Err.LastDllError, "InternetOpen"
EnableUI (True)
End Sub
Private Sub cmdClosehOpen_Click()
If hConnection <> 0 Then InternetCloseHandle (hConnection)
If hOpen <> 0 Then InternetCloseHandle (hOpen)
hConnection = 0
hOpen = 0
If bActiveSession Then TreeView1.Nodes.Remove txtServer.Text
bActiveSession = False
ClearTextBoxAndBag
EnableUI (False)
End Sub
Private Sub cmdConnect_Click()
If Not bActiveSession And hOpen <> 0 Then
If txtServer.Text = "" Then
MsgBox "Please enter a server name!"
Exit Sub
End If
Dim nFlag As Long
If chkPassive.Value Then
nFlag = INTERNET_FLAG_PASSIVE
Else
nFlag = 0
End If
hConnection = InternetConnect(hOpen, txtServer.Text, INTERNET_INVALID_PORT_NUMBER, _
txtUser,